<?php

/**
 * @author FROSTY (valik619)
 * @site nadmad.ru
 * @mail valik619@inbox.ru
 */

$categories=mysql_query("SELECT * FROM `cat` ORDER BY `order`");
while($row=mysql_fetch_assoc($categories)){
    $posts = mysql_query("SELECT * FROM `posts` WHERE `catid` = '$row[id]'");
    $p = mysql_num_rows($posts); 
    echo '<div class="title"><a href="cat/index.php?id='.$row['id'].'">'.$row['name'].'</a> ['.$p.']</div>';
    };

/**
 * @author FROSTY (valik619)
 * @site nadmad.ru
 * @mail valik619@inbox.ru
 */

?>